jQuery.noConflict();
var confirmButtonClick = 1;

jQuery("#subscribeButton").live("click", function(){
	confirmButtonClick = confirmButtonClick + 1;
	var allowedConfirmClicks = 4;
	
	if(jQuery("input[name=cbacn]").length){
		allowedConfirmClicks = jQuery("input[name=cbacn]").val();
	}
	if(confirmButtonClick > allowedConfirmClicks){
		return false;
	}
});
jQuery(document).ajaxComplete(function(){
    try{
        FB.XFBML.parse(); 
        gapi.plusone.go();
    }catch(ex){}
});

function changeSelectStyle(){
	jQuery('select.select').each(function(){
		var title = jQuery(this).attr('title');
		if( jQuery('option:selected', this).val() != ''  ) title = jQuery('option:selected',this).text();
		jQuery(this)
			.css({'z-index':20,'opacity':0,'-khtml-appearance':'none'})
			.after('<span class="select">' + title + '</span>')
			.change(function(){
				val = jQuery('option:selected',this).text();
				jQuery(this).next().text(val);
			});
	});
}

function pointsCount()
{
	var data = 'act=upc';
	var container = ".points_count";
	
	ajaxRequest(data, container);
}

function isUrl(s) {
	var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
	//var regexp = /((\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
	return regexp.test(s);
}

function ajaxRequest(reqData, container, extraFunc, extraParams, appendResult){
	var request = jQuery.ajax({
		url: "/../includes/ajax.php",
		type: "POST",
		data: reqData,
		//dataType: "json",
		cache: false,
		success: function(result){
			if(typeof(appendResult) == 'undefined'){
				
				if(result != 2  && result!='register' && result!='plaeseagree'  && result.indexOf("3***")===-1)
				{
					jQuery(container).html(result);
				}
				else if(result.indexOf("3***")!==-1)
				{
					result = result.split("3***");
					
					popup(result[1]);
				}
				
			} else if( result!='register') {
				jQuery(appendResult).last().after('<li class="pager">'+result+'</li>');
			}
			
			if(eval("typeof " + extraFunc + " == 'function'")){
				if(result == 2){
					extraParams = result;
				}
				else if(result == 'register')
				{
					window.location.href="/"+result;
				}
				
				var params = (extraParams != 'undefined') ? '(extraParams)' : '()';
				eval(extraFunc+params);
			}
		},
		error: function(){
			
		}
	});
}
function profile(){
	var opass = jQuery("#r_old_pass").val();
	var pass  = jQuery("#r_pass").val();
	var re_pass = jQuery("#r_re_pass").val();
	
	var data = 'act=profile&params={"ops":"'+opass+'", "ps":"'+pass+'", "rps":"'+re_pass+'"}';
	var container = ".profile_block";	
	//alert('kkk');
	ajaxRequest(data, container);
}

function coupone(){
	
	var secure = jQuery("#r_coupon").val();
	//alert('jjjj');
	var data = 'act=coupone&params={"coupone":"'+secure+'"}';
	var container = ".coupone_block";	
	ajaxRequest(data, container);
}

function ajaxRequest2(reqData, container, extraFunc, extraParams){
	var request = jQuery.ajax({
		url: "/../includes/ajax.php",
		type: "POST",
		data: reqData,
		cache: false,
		success: function(result){
			jQuery(container).hideLoading();
			jQuery(container).html(result);
			
			var params = (extraParams != 'undefined') ? '(extraParams)' : '()';
			eval(extraFunc+params);
		}
	});
}

function login(){
	var email = jQuery("#l_email").val();
	var pass  = jQuery("#l_pass").val();
	var rememeber = 0;
	if(jQuery('#l_rem').is(':checked')){
		rememeber = 1;
	}
	
	var data = 'act=login&params={"email": "'+email+'", "ps": "'+pass+'", "rem":"'+rememeber+'"}';
	var container = ".reg_block";
	ajaxRequest(data, container, 'redirAfterLogin');
}

function redirAfterLogin(param){
	if(param != 'undefined' && param == 2){
		location.href="en/login.html";
	}
}

function registration(){
	var email = jQuery("#r_email").val();
	var pass  = jQuery("#r_pass").val();
	var re_pass = jQuery("#r_re_pass").val();
	var secure = jQuery("#capt").val();
	
	var data = 'act=register&params={"email":"'+email+'", "ps":"'+pass+'", "rps":"'+re_pass+'", "scode":"'+secure+'"}';
	//var container = ".reg_block";
	var container = "#reg-block";
	ajaxRequest(data, container, 'relaodSecImg');
}
var agree = -1
function regAgreement(agree){
	
	var data = 'act=agreement&params={"agree":"'+agree+'"}';
	
	ajaxRequestAgreement(data);
}

function ajaxRequestAgreement(reqData, container, extraFunc, extraParams, appendResult){
	
	var request = jQuery.ajax({
		url: "/../includes/ajax.php",
		type: "POST",
		data: reqData,
		//dataType: "json",
		cache: false,
		success: function(result){
			if(result==1)
			{
				jQuery("#error_text").css('display','none');
				window.location.href="register-2.html";
			}
			else if(result==2)
				{
				window.location.href="home-2.html";
				}
			else
			{
				jQuery("#error_text").html(result);
				jQuery("#error_text").css('display','block');
			}
		},
		error: function(){
			
		}
	});
}


function relaodSecImg(param){
	if(param != 'undefined' && param == 2){
		location.href="en/login.html";
	}
	if(jQuery("#siimage").length)
		document.getElementById('siimage').src = 'securimage/securimage_show7278.png?sid=' + Math.random();
}

function addSite(){
	var title = jQuery("#l_title").val();
	var url  = jQuery("#l_url").val();
	var type = jQuery("#l_type").val();
	if(typeof url !== "undefined" && url)
	{
		url = url.replace(/\&/g,"*#39");
	}
	if(type == 17){
		url = url.replace(/(\r\n|\n|\r)/gm, "<br>");
	}
	url = encodeURIComponent(url);
	var cpc = jQuery("#l_cpc").val();
	var wte = jQuery("input[name=wte]").val();
	var nttype = jQuery("input[name=network_type]").val();
	var priority = 0;
	var clicks = jQuery("#l_clicks").val();
	var daily = jQuery("#l_daily").val();
	var countries = (jQuery('#ww').is(":checked") ? null : jQuery("#l_country").val());
	
	if(jQuery("#check-priority").length){
		if(jQuery("#check-priority").is(":checked")){
			priority = jQuery("#check-priority").val();
		}
	}
	
	var data = 'act=addsite&params={"title":"'+title+'", "url":"'+url+'", "type":"'+type+'", "cpc":"'+cpc+'", "wte":"'+wte+'", "nttype":"'+nttype+'", "priority":"'+priority+'", "clicks":"'+clicks+'", "daily":"'+daily+'", "countries":"'+countries+'"}';
	//var data = 'act=addsite&params={"title":"'+title+'", "url":"'+url+'", "type":"'+type+'", "cpc":"'+cpc+'", "wte":"'+wte+'", "nttype":"'+nttype+'", "priority":"'+priority+'", "clicks":"'+clicks+'", "daily":"'+daily+'"}';
	
	jQuery('#link_form').showLoading();
	var container = ".add-site-form";
	ajaxRequest(data, container, "afterFormError");
}

function afterFormError(){
	if(jQuery('#link_form').length){
		jQuery('#link_form').hideLoading();
	}
	changeSelectStyle();
}

function getLinksList(page){
	
	confirmButtonClick = 1;
	
	if (typeof page == 'undefined') {
		var page = jQuery("input[name=page]").val();
		if(!jQuery("input[name=page]").length){
			page = 1;
		} 
	}
	
	
	var container = "#site-links-list";
	if(!jQuery(".loading-indicator").length){
		jQuery(container).showLoading();
	}
	var network = jQuery("#network").val();
	clearTimeout(reloadTimeOut);
	if(network != 5 && network != 10){
		tout();
	}
	
	//checkCaptchNeed();
	
	if(network == 1){
		jQuery(".freepts_col3 > img").attr("src", "images/layout/fb_button.png");
	}
	else if(network == 2){
		jQuery(".freepts_col3 > img").attr("src", "images/layout/google_button.png");
	}
	else if(network == 3){
		jQuery(".freepts_col3 > img").attr("src", "images/layout/twitter_button.png");
	}
	else if(network == 5){
		jQuery(".freepts_col3 > img").attr("src", "images/layout/youtube_button.png");
	}
	else if(network == 6){
		jQuery(".freepts_col3 > img").attr("src", "images/layout/youtube_subscribe_button.png");
	}
	else if(network == 9){
		jQuery(".freepts_col3 > img").attr("src", "images/layout/google_circle_button.png");
	}
	if(network==5)
	{
		var data = 'act=getYoutubeVideos&params={"network":"'+network+'", "page":"'+page+'"}';
		container = "#site-links-list";
		ajaxRequest2(data, container, 'setPageNum', page);	
	}
	else if(network==10)
	{
		var data = 'act=getSoundCloudItems&params={"network":"'+network+'", "page":"'+page+'"}';
		container = "#site-links-list";
		ajaxRequest2(data, container, 'setPageNum', page);
	}
	else
	{	
		var data = 'act=getLinksList&params={"network":"'+network+'", "page":"'+page+'"}';
		container = "#site-links-list";
		ajaxRequest2(data, container, 'setPageNum', page);
	}
}
 
function likeback(url){
	
	if(jQuery("div[title='"+url+"']").length){
	//	alert('like');
		var linkId = jQuery("div[title='"+url+"']").attr("id");
		updateAction(linkId, url, 1);
		var txt = jQuery("div[title='"+url+"']").find("span").html();
		jQuery.msgbox(txt);
		jQuery("div[title='"+url+"']").remove();
	}
	else if(jQuery("li[title='"+url+"']").length){
		var linkId = jQuery("li[title='"+url+"']").attr("class");
		//alert(linkId+"*******"+url);
		updateAction(linkId, url, 1);
		var txt = jQuery("li[title='"+url+"']").find("span").html();
		jQuery.msgbox(txt);
		jQuery("li[title='"+url+"']").remove();
	}
	
	if(jQuery("#form1").find('div').hasClass('freepts_row') == false){
		jQuery("#next-page").click();
	}	
}
function plusback(plusone){
	if(plusone.state != 'off'){
		var url = removeLastSlash(plusone.href);
		if(jQuery("div[title='"+url+"']").length){
			var linkId = jQuery("div[title='"+url+"']").attr("id");
			updateAction(linkId, url, 2);
			var txt = jQuery("div[title='"+url+"']").find("span").html();
			jQuery.msgbox(txt);
			//jQuery("div[title='"+url+"']").remove();
			jQuery("div[title='"+url+"']").css('display','none');
		}
		else if(jQuery("li[title='"+url+"']").length){
			var linkId = jQuery("li[title='"+url+"']").attr("class");
			updateAction(linkId, url, 2);
			var txt = jQuery("li[title='"+url+"']").find("span").html();
			jQuery.msgbox(txt);
			//jQuery("li[title='"+url+"']").remove();
			jQuery("li[title='"+url+"']").css('display','none');
		}
		
		if(jQuery("#form1").find('div').hasClass('freepts_row') == false){
			jQuery("#next-page").click();
		}
	}
}
function twitterFollow(twName,userid)
{	
	 if(twName && userid)
	 {
		 var url_part = removeLastSlash(twName);
		 var url = 'https://twitter.com/'+url_part;
		 var url2 = 'https://twitter.com/#!/'+url_part;
		 var url3 = 'https://www.twitter.com/'+url_part;
		 var url4 = 'https://www.twitter.com/#!/'+url_part;
		 var url5 = 'http://twitter.com/'+url_part;
		 var url6 = 'http://twitter.com/#!/'+url_part;
		 var url7 = 'http://www.twitter.com/'+url_part;
		 var url8 = 'http://www.twitter.com/#!/'+url_part;
		 if(jQuery("div[title='"+url+"']").length)
		 {
			 tw_url = url;
		 }
		 else if(jQuery("div[title='"+url2+"']").length)
		 {
			 tw_url = url2;
		 }
		 else if(jQuery("div[title='"+url3+"']").length)
		 {
			 tw_url = url3;
		 }
		 else if(jQuery("div[title='"+url4+"']").length)
		 {
			 tw_url = url4;
		 }
		 else if(jQuery("div[title='"+url5+"']").length)
		 {
			 tw_url = url5;
		 }
		 else if(jQuery("div[title='"+url6+"']").length)
		 {
			 tw_url = url6;
		 }
		 else if(jQuery("div[title='"+url7+"']").length)
		 {
			 tw_url = url7;
		 }
		 else if(jQuery("div[title='"+url8+"']").length)
		 {
			 tw_url = url8;
		 }
		 if(jQuery("li[title='"+url+"']").length)
		 {
			 tw_url = url;
		 }
		 else if(jQuery("li[title='"+url2+"']").length)
		 {
			 tw_url = url2;
		 }
		 else if(jQuery("li[title='"+url3+"']").length)
		 {
			 tw_url = url3;
		 }
		 else if(jQuery("li[title='"+url4+"']").length)
		 {
			 tw_url = url4;
		 }
		 else if(jQuery("li[title='"+url5+"']").length)
		 {
			 tw_url = url5;
		 }
		 else if(jQuery("li[title='"+url6+"']").length)
		 {
			 tw_url = url6;
		 }
		 else if(jQuery("li[title='"+url7+"']").length)
		 {
			 tw_url = url7;
		 }
		 else if(jQuery("li[title='"+url8+"']").length)
		 {
			 tw_url = url8;
		 }
		 if(jQuery("div[title='"+tw_url+"']").length){
				var linkId = jQuery("div[title='"+tw_url+"']").attr("id");
				updateAction(linkId, tw_url, 3);
				var txt = jQuery("div[title='"+tw_url+"']").find("span").html();
				jQuery.msgbox(txt);
				//jQuery("div[title='"+url+"']").remove();
				jQuery("div[title='"+tw_url+"']").css('display','none');
			}
		 else if(jQuery("li[title='"+tw_url+"']").length){
			
				var linkId = jQuery("li[title='"+tw_url+"']").attr("class");
				updateAction(linkId, tw_url, 3);
				var txt = jQuery("li[title='"+tw_url+"']").find("span").html();
				jQuery.msgbox(txt);
				//jQuery("li[title='"+url+"']").remove();
				jQuery("li[title='"+tw_url+"']").css('display','none');
			}
		 
			
			
			if(jQuery("#form1").find('div').hasClass('freepts_row') == false){
				jQuery("#next-page").click();
			}
	}
	
}

function removeLastSlash(target){
	
	var urlEnd = target.length;
	
	// Don't bother doing anything if the URL is empty
	if (urlEnd > 0){
	    if (target[urlEnd - 1] == "index.html"){
	       return target.substr(0, urlEnd-1) + target.substr(urlEnd);
	    } else {
	    	return target;
	    }
	}
}

function setPageNum(page){
	jQuery("div.twitter-single").hideLoading();
	jQuery("#site-links-list").hideLoading();
	jQuery("input[name=page]").val(page);
}

function updateAction(linkId, url, network, code, msg, cpc, link_title){
	url = url.replace(/\&/g,"*#39");
	
	var reqData = 'act=updateAction&params={"link_id":"'+linkId+'", "url":"'+url+'", "network":"'+network+'", "IXY5pZpE":"'+code+'"}';
	
	jQuery.ajax({
		url: "/../includes/ajax.php",
		type: "POST",
		data: reqData,
		cache: false,
		success: function(result){
			if(result > 0 || result < 0){
				jQuery(".points_count").html(result);
				var rData = 'act=getLikeNote&params={"m":"'+msg+'", "cpc":"'+cpc+'", "title":"'+link_title+'"}';
				jQuery(".like_notification").show();
				ajaxRequest(rData, '.like_notification');
			}
			getLinksList(1);
		}
	});
}

function forgot(){
	var email = jQuery("#f_email").val();
	var code  = jQuery("#secure").val();
	
	var data = 'act=forgot&params={"email":"'+email+'", "secure":"'+code+'"}';
	var container = ".reg_block";
	ajaxRequest(data, container, 'relaodForgotSecImg');
}

function relaodForgotSecImg(param){
	if(param != 'undefined' && param == 2){
		location.href="recover.html";
	}
	if(jQuery("#siimage").length)
		document.getElementById('siimage').src = 'securimage/securimage_show7278.png?sid=' + Math.random();
}

function resetPassCode(){
	var code  = jQuery("#f_code").val();
	
	var data = 'act=reset&params={"code":"'+code+'"}';
	var container = ".reg_block";
	ajaxRequest(data, container);
}

function newPass(){
	var pass  = jQuery("#f_pass").val();
	var re_pass  = jQuery("#f_re_pass").val();
	var u_id  = jQuery("input[name=pass_u]").val();
	
	var data = 'act=newPass&params={"pass":"'+pass+'", "re_pass":"'+re_pass+'", "u_id":"'+u_id+'"}';
	var container = ".reg_block";
	ajaxRequest(data, container);
}
function changeSiteLinkField(blockid,blockid2,text1,text2,text3,text4,text5,text6,text7,note1,note2,note3,note4,note5,note6,note7,note8,note9,note10,text15,note15,text17,note17,text18,note18,text19,note19,text21,note21,text22,note22,text23,note23,text25,note25,text26,note26,text29,note29,text30,note30,text20,note20,text31,note31,text32,note32)
{
	$comboval = jQuery('#l_type').val();
	
	jQuery('textarea#l_url').after('<input name="url" type="text" class="col2" id="l_url" value="">');
	jQuery('textarea#l_url').remove();
	jQuery('.jqEasyCounterMsg').remove();
	
	if($comboval=='9')
	{
		jQuery('#'+blockid).html(text5);
		jQuery('#'+blockid2).html(note5);
		jQuery('#siteTitle').css('display','block');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='3')
	{
		jQuery('#'+blockid).html(text2);
		jQuery('#'+blockid2).html(note2);
		jQuery('#siteTitle').css('display','none');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='5' || $comboval=='8' || $comboval=='31')
	{
		jQuery('#'+blockid).html(text3);
		jQuery('#'+blockid2).html(note3);
		jQuery('#siteTitle').css('display','block');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','block');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
	}
	else if($comboval=='6')
	{
		jQuery('#'+blockid).html(text4);
		jQuery('#'+blockid2).html(note4);
		jQuery('#siteTitle').css('display','block');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','block');
	}
	else if($comboval=='7')
	{
		jQuery('#'+blockid).html(text6);
		jQuery('#'+blockid2).html(note6);
		jQuery('#siteTitle').css('display','none');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='11')
	{
		jQuery('#'+blockid).html(text7);
		jQuery('#'+blockid2).html(note7);
		jQuery('#siteTitle').css('display','none');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='12')
	{
		jQuery('#'+blockid).html(text7);
		jQuery('#'+blockid2).html(note8);
		jQuery('#siteTitle').css('display','none');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='13')
	{
		jQuery('#'+blockid).html(text7);
		jQuery('#'+blockid2).html(note9);
		jQuery('#siteTitle').css('display','none');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='14')
	{
		jQuery('#'+blockid).html(text7);
		jQuery('#'+blockid2).html(note10);
		jQuery('#siteTitle').css('display','none');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='15' || $comboval=='16')
	{
		jQuery('#'+blockid).html(text15);
		jQuery('#'+blockid2).html(note15);
		jQuery('#siteTitle').css('display','none');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='17')
	{
		jQuery('#'+blockid).html(text17);
		jQuery('#'+blockid2).html(note17);
		jQuery('#siteTitle').css('display','none');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
		jQuery('#l_url').after('<textarea name="url" class="area_col2" id="l_url"></textarea>');
		jQuery('input#l_url').remove();
		jQuery(".area_col2").jqEasyCounter({
		    'maxChars': 255,
		    'maxCharsWarning': 140,
		    'msgFontSize': '12px',
		    'msgFontColor': '#000',
		    'msgFontFamily': 'Arial',
		    'msgTextAlign': 'left',
		    'msgWarningColor': '#F00',
		    'msgAppendMethod': 'insertBefore'              
		});
	}
	else if($comboval=='18')
	{
		jQuery('#'+blockid).html(text18);
		jQuery('#'+blockid2).html(note18);
		jQuery('#siteTitle').css('display','block');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='19')
	{
		jQuery('#'+blockid).html(text19);
		jQuery('#'+blockid2).html(note19);
		jQuery('#siteTitle').css('display','none');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='32')
	{
		jQuery('#'+blockid).html(text32);
		jQuery('#'+blockid2).html(note32);
		jQuery('#siteTitle').css('display','block');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='21')
	{
		jQuery('#'+blockid).html(text21);
		jQuery('#'+blockid2).html(note21);
		jQuery('#siteTitle').css('display','none');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='22')
	{
		jQuery('#'+blockid).html(text22);
		jQuery('#'+blockid2).html(note22);
		jQuery('#siteTitle').css('display','none');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='20')
	{
		jQuery('#'+blockid).html(text20);
		jQuery('#'+blockid2).html(note20);
		jQuery('#siteTitle').css('display','none');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='23')
	{
		jQuery('#'+blockid).html(text23);
		jQuery('#'+blockid2).html(note23);
		jQuery('#siteTitle').css('display','block');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='24')
	{
		jQuery('#'+blockid).html(text23);
		jQuery('#'+blockid2).html(note23);
		jQuery('#siteTitle').css('display','block');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='25')
	{
		jQuery('#'+blockid).html(text25);
		jQuery('#'+blockid2).html(note25);
		jQuery('#siteTitle').css('display','block');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='26' || $comboval=='27')
	{
		jQuery('#'+blockid).html(text26);
		jQuery('#'+blockid2).html(note26);
		jQuery('#siteTitle').css('display','block');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='28')
	{
		jQuery('#'+blockid).html(text25);
		jQuery('#'+blockid2).html(note25);
		jQuery('#siteTitle').css('display','block');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='29')
	{
		jQuery('#'+blockid).html(text29);
		jQuery('#'+blockid2).html(note29);
		jQuery('#siteTitle').css('display','block');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else if($comboval=='30')
	{
		jQuery('#'+blockid).html(text30);
		jQuery('#'+blockid2).html(note30);
		jQuery('#siteTitle').css('display','block');
		
		jQuery('#NotificationTextFb').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		jQuery('#NotificationTextYoutube').css('display','none');
	}
	else
	{
		jQuery('#'+blockid).html(text1);
		jQuery('#'+blockid2).html(note1);
		jQuery('#siteTitle').css('display','block');
		jQuery('#NotificationTextYoutube').css('display','none');
		jQuery('#NotificationTextYoutubeChannel').css('display','none');
		
	}
}
function checkBonusPointsAdd()
{
	jQuery('.loadingSubs').css('display','block');
	jQuery('#subscribeButton').css('display','none');
	
	
	jQuery.ajax({

		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=checkBonusPointsAdded',    
		success: function(msg){
 //alert(msg);
			if(msg==1)
			{
				jQuery('#errorSubscribeCont').css('display','none');
				jQuery('#errorSubscribeCont').html('');
				
				jQuery("div[title='daily_bonus']").css('display','block');
				jQuery('.loadingSubs').css('display','none');
				//jQuery("div[title='no_bonus']").css('display','block');				
			}
			else
			{
				jQuery('#errorSubscribeCont').css('display','block');
				jQuery('#errorSubscribeCont').html(msg);
				jQuery('.loadingSubs').css('display','none');
				//jQuery('#subscribeButton').css('display','block');
			}
			
			

	}

	});			
}
function youtubeSubscribed(id,url,linkId,network, isPriority, code, cpc, link_title)
{
	var allowedConfirmClicks = 4;
	if(jQuery("input[name=cbacn]").length){
		allowedConfirmClicks = jQuery("input[name=cbacn]").val();
	}
	if(confirmButtonClick > allowedConfirmClicks){
		return false;
	}
	
	var prior = '';
	if(isPriority != undefined && isPriority == 1){
		prior = 'Priority';
	}
	
	jQuery('.loadingSubs').css('display','block');
	jQuery('#subscribeButton'+prior).css('display','none');
	url2 = url.replace(/\&/g,"*#39");
	
	jQuery("#site-links-list").html("&nbsp;");
	jQuery("#site-links-list").showLoading();
	
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=checkYoutubeSubscribed&params={"link_id":"'+id+'", "url":"'+url2+'"}',    
		success: function(msg){
			if(msg==1)
			{
				updateAction(linkId, url2, network, code);
				var rData = 'act=getLikeNote&params={"m":"'+msg+'", "cpc":"'+cpc+'", "title":"'+link_title+'"}';
				jQuery(".like_notification").show();
				ajaxRequest(rData, '.like_notification');
				getLinksList(1);
				
			}
			else
			{
				var rData = 'act=getLikeNote&params={"m":"'+msg+'", "cpc":"'+cpc+'", "title":"'+link_title+'"}';
				jQuery(".like_notification").show();
				ajaxRequest(rData, '.like_notification');
				getLinksList(1);
			}
			

		}

	});			
}
function gCircled(id,url,linkId,network, isPriority, code)
{
	var allowedConfirmClicks = 4;
	if(jQuery("input[name=cbacn]").length){
		allowedConfirmClicks = jQuery("input[name=cbacn]").val();
	}
	if(confirmButtonClick > allowedConfirmClicks){
		return false;
	}
	var prior = '';
	if(isPriority != undefined && isPriority == 1){
		prior = 'Priority';
	}
	
	jQuery('.loadingSubs').css('display','block');
	jQuery('#subscribeButton'+prior).css('display','none');
	url2 = url.replace(/\&/g,"*#39");
	
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=checkgCircled&params={"link_id":"'+id+'", "url":"'+url2+'"}',    
		success: function(msg){
			if(msg==1)
			{
				jQuery('#errorSubscribeCont'+prior).css('display','none');
				jQuery('#errorSubscribeCont'+prior).html('');
				
				var up_res = updateAction(linkId, url2, network, code);
				if(up_res == false){
					return;
				}
				
				var txt = jQuery("div[title='"+url+"']").find("span").html();
				//jQuery.msgbox(txt);
				//jQuery("div[title='"+url+"']").css('display','none');
				var page = jQuery("input[name=page]").val();
				var all_count = jQuery("input[name=alc]").val();
				
				if(page==all_count && page>1)
				{
					page=page-1;
				}
				
				jQuery(".likebutton"+prior).remove();
				jQuery('#errorSubscribeCont'+prior).after('<div class="green">'+txt+'</div>');
				jQuery('#errorSubscribeCont'+prior).remove();
				jQuery("#subscribeButton"+prior).remove();
				jQuery(".skip_button_"+prior).remove();
				jQuery(".skip_button"+prior).remove();
				
				//getLinksList(page);
				
				if(prior != ''){
					var linkIdArr = linkId.split('_');
					if(linkIdArr[1] != undefined){
						var pidClass = '.p_'+linkIdArr[1];
						jQuery(pidClass).find("div.like").after('<div class="green-priority">'+txt+'</div>');
						jQuery(pidClass).find("div.like").remove();
					}
					jQuery("#dialog-ui").dialog("close");
				}
			}
			else
			{
				jQuery('#errorSubscribeCont'+prior).css('display','block');
				jQuery('#errorSubscribeCont'+prior).html(msg);
				jQuery(".likebutton").remove();
				jQuery("#subscribeButton").remove();
			}
			
			jQuery('.loadingSubs').css('display','none');
			jQuery('#subscribeButton'+prior).css('display','block');
	}
	});			
}
function facebookLiked(id,url,linkId,network)
{
	jQuery('.loadingSubs').css('display','block');
	jQuery('#subscribeButton').css('display','none');
	
	jQuery.ajax({

		type: "POST",

		url: "/../includes/ajax.php",

		data: 'act=FacebookPageLike&params={"link_id":"'+linkId+'", "url":"'+url+'"}',    

		success: function(msg){
 //alert(msg);
			if(msg==1)
			{
				jQuery('#fbBlock'+linkId).html('<center><img src="/images/layout/loading-small.gif" alt="Loadin..." title="Loading..." /></center>');
				
				updateAction(linkId, url, network);
				
				var txt = jQuery("div[title='"+url+"']").find("span").html();
				jQuery.msgbox(txt);
				
				var page = jQuery("input[name=page]").val();
				var all_count = jQuery("input[name=alc]").val();
				if(page==all_count && page>1)
					{
					page=page-1;
					}
				//alert(all_count+"***"+page);
				getLinksList(page);
				
			}
			else
			{
				jQuery('#errorSubscribeCont').css('display','block');
				jQuery('#errorSubscribeCont').html(msg);
			}
			jQuery('.loadingSubs').css('display','none');
			jQuery('#subscribeButton').css('display','block');
	}
	});			
}

jQuery(".skip_button").live("click", function(){
	var lid = jQuery(this).attr("id");
	var network = jQuery("#network").val();
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=skipLink&params='+lid,    
		success: function(res){
			if(res){
				jQuery('#'+res).remove();
				if( !jQuery('div.freepts_row').length ){
					if(jQuery("#next-page").length && network != 1){
						jQuery("#next-page").click();
					}
					else
					{
						if(network == 6){
							getLinksList(1);
						}
					}
				}
				/*if(!jQuery(".yt-video-content").length){
					if(jQuery("#next-page").length){
						jQuery("#next-page").click();
					}
				}*/
			}
		}
	});
});

jQuery(".skip_button_single").live("click", function(){
	var lid = jQuery(this).attr("id");
	jQuery("#site-links-list").html('');
	jQuery("#site-links-list").showLoading();
	var network = jQuery("#network").val();
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=skipLink&params='+lid,    
		success: function(res){
			if(res){
				getLinksList(1);
			} else {
				jQuery("#site-links-list").hideLoading();
			}
		}
	});
});

jQuery(".skip_tw").live("click", function(){
	var lid = jQuery(this).attr("id");
	var curElem = jQuery(this).parent("div.twitter-single");
	curElem.showLoading();
	jQuery(this).prev("a.tw_follow_button").prev("div").prev("div").remove();
	jQuery(this).prev("a.tw_follow_button").remove();
	jQuery(this).remove();
	
	
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=skipLink&params='+lid,    
		success: function(res){
			curElem.hideLoading();
			curElem.append('<div class="skiped">Skiped<div>');
		}
	});
});

jQuery("button.show-hide").live("click", function(){
	var showStatus = jQuery(this).val();
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=showHideBlockedLinks&params='+showStatus,    
		success: function(res){
			window.location.reload();
		}
	});
});


/*************  Paging  ***************/
function pLocation(page){
	var url = window.location.href;
    var mtc = url.match(/-\d+$/);
    if(mtc != null){
  	  url = url.replace(/-\d+$/, '-'+page);
    } else {
  	  url = url+'-'+page;
    }
    window.location.href = url;
} 
jQuery('input[name=cur_page]').live('keydown', function (e) {
   if (e.shiftKey || e.ctrlKey || e.altKey) { // if shift, ctrl or alt keys held down
       e.preventDefault();         // Prevent character input
   } else {
       var n = e.keyCode;
       if (!((n == 8)              // backspace
       || (n == 13)                // enter
       || (n == 46)                // delete
       || (n >= 35 && n <= 40)     // arrow keys/home/end
       || (n >= 48 && n <= 57)     // numbers on keyboard
       || (n >= 96 && n <= 105))   // number on keypad
       ) {
           e.preventDefault();     // Prevent character input
       }
   }
}).live('keyup', function(el) {
	  if(el.keyCode == 13){
	      var page = jQuery(this).val();
	      pLocation(page);
     }
});
  
jQuery(".p-first").live("click", function(){
	var page = 1;
	pLocation(page);
	return false;
});

jQuery(".p-prev").live("click", function(){
	var page = parseInt(jQuery('input[name=cur_page]').val()) - 1;
	if(page < 1) page = 1;
	pLocation(page);
	return false;
});

jQuery(".p-next").live("click", function(){
	var page = parseInt(jQuery('input[name=cur_page]').val()) + 1;
	pLocation(page);
	return false;
});

jQuery(".p-last").live("click", function(){
	var page = parseInt(jQuery('#all-pages').html());
	pLocation(page);
	return false;
});

/*************  Paging  ***************/

jQuery(".n_add_acc").live("click", function(){
	jQuery("#site-links-list").showLoading();
	var n_u_name = jQuery("#a_username").val();
	n_u_name = encodeURIComponent(n_u_name);
	var ntw = jQuery("input[name=ntw]").val();
	ntw = parseInt(ntw);
	
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=addNetAcc&params={"username":"'+n_u_name+'", "ntw":"'+ntw+'"}',    
		success: function(msg){
			jQuery("#site-links-list").hideLoading();
			jQuery(".nooottff").html(msg);
		}
	});	
});

function sendConfirmEmail(){
	var secure = jQuery("#sec_code").val();
	var data = 'act=sendConfirmEmail&params={"code":"'+secure+'"}';
	var container = ".low_points_block";	

	ajaxRequest(data, container);
}

function confirmFollow(id,url,linkId,network, isPriority, code)
{
	var allowedConfirmClicks = 4;
	if(jQuery("input[name=cbacn]").length){
		allowedConfirmClicks = jQuery("input[name=cbacn]").val();
	}
	
	if(confirmButtonClick > allowedConfirmClicks){
		return false;
	}
	
	var prior = '';
	if(isPriority != undefined && isPriority == 1){
		prior = 'Priority';
	}
	
	jQuery('.loadingSubs').css('display','block');
	jQuery('#subscribeButton'+prior).css('display','none');
	url2 = url.replace(/\&/g,"*#39");
	
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=checkFollowed&params={"id":"'+id+'", "url":"'+url+'", "network":"'+network+'"}',    
		success: function(msg){
			if(msg==1)
			{
				jQuery('#errorSubscribeCont'+prior).css('display','none');
				jQuery('#errorSubscribeCont'+prior).html('');
				
				var up_res = updateAction(linkId, url2, network, code);
				if(up_res == false){
					return;
				}
				
				var txt = jQuery("div[title='"+url+"']").find("span").html();
				
				jQuery(".likebutton"+prior).remove();
				jQuery('#errorSubscribeCont'+prior).after('<div class="green">'+txt+'</div>');
				jQuery('#errorSubscribeCont'+prior).remove();
				jQuery("#subscribeButton"+prior).remove();
				jQuery(".skip_button_"+prior).remove();
				jQuery(".skip_button"+prior).remove();
				
				if(prior != ''){
					var linkIdArr = linkId.split('_');
					if(linkIdArr[1] != undefined){
						var pidClass = '.p_'+linkIdArr[1];
						jQuery(pidClass).find("div.like").after('<div class="green-priority">'+txt+'</div>');
						jQuery(pidClass).find("div.like").remove();
					}
					jQuery("#dialog-ui").dialog("close");
				}
			}
			else
			{
				jQuery('#errorSubscribeCont'+prior).css('display','block');
				jQuery('#errorSubscribeCont'+prior).html(msg);
				jQuery(".likebutton").remove();
				jQuery("#subscribeButton").remove();
			}
			
			jQuery('.loadingSubs').css('display','none');
			jQuery('#subscribeButton'+prior).css('display','block');
		}
	});			
}

function confirmSubscribe(id,url,linkId,network, isPriority, code){
	var allowedConfirmClicks = 4;
	if(jQuery("input[name=cbacn]").length){
		allowedConfirmClicks = jQuery("input[name=cbacn]").val();
	}
	if(confirmButtonClick > allowedConfirmClicks){
		return false;
	}
	
	var prior = '';
	if(isPriority != undefined && isPriority == 1){
		prior = 'Priority';
	}
	jQuery('.loadingSubs').css('display','block');
	jQuery('#subscribeButton'+prior).css('display','none');
	url2 = url.replace(/\&/g,"*#39");
	
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=checkFollowed&params={"id":"'+id+'", "url":"'+url+'", "network":"'+network+'"}',    
		success: function(msg){
			if(msg==1)
			{
				jQuery('#errorSubscribeCont'+prior).css('display','none');
				jQuery('#errorSubscribeCont'+prior).html('');
				
				var up_res = updateAction(linkId, url2, network, code);
				if(up_res == false){
					return;
				}
				
				var txt = jQuery("div[title='"+url+"']").find("span").html();
				
				jQuery(".likebutton"+prior).remove();
				jQuery(".likedPages"+prior).remove();
				jQuery('#errorSubscribeCont'+prior).after('<div class="green">'+txt+'</div>');
				jQuery('#errorSubscribeCont'+prior).remove();
				jQuery("#subscribeButton"+prior).remove();
				jQuery(".skip_button_"+prior).remove();
				jQuery(".skip_button"+prior).remove();
				
				if(prior != ''){
					var linkIdArr = linkId.split('_');
					if(linkIdArr[1] != undefined){
						var pidClass = '.p_'+linkIdArr[1];
						jQuery(pidClass).find("div.like").after('<div class="green-priority">'+txt+'</div>');
						jQuery(pidClass).find("div.like").remove();
					}
					jQuery("#dialog-ui").dialog("close");
				}
			}
			else
			{
				jQuery('#errorSubscribeCont'+prior).css('display','block');
				jQuery('#errorSubscribeCont'+prior).html(msg);
				jQuery(".likebutton").remove();
				jQuery("#subscribeButton").remove();
			}
			
			jQuery('.loadingSubs').css('display','none');
			jQuery('#subscribeButton'+prior).css('display','block');
		}
	});
}
function confirmSubscribeFB(id,url,linkId,network, isPriority, code){
	var allowedConfirmClicks = 4;
	if(jQuery("input[name=cbacn]").length){
		allowedConfirmClicks = jQuery("input[name=cbacn]").val();
	}
	if(confirmButtonClick > allowedConfirmClicks){
		return false;
	}
	
	var prior = '';
	if(isPriority != undefined && isPriority == 1){
		prior = 'Priority';
	}
	jQuery('.loadingSubs').css('display','block');
	jQuery('#subscribeButton'+prior).css('display','none');
	url2 = url.replace(/\&/g,"*#39");
        
        
        jQuery("#fbl_"+id).after("<img id='"+id+"' src='/img/loader.gif'>");
        jQuery("#fbl_"+id).remove();
	
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=checkFollowed&params={"id":"'+id+'", "url":"'+url+'", "network":"'+network+'"}',    
		success: function(msg){
			if(msg==1)
			{
				
				var up_res = updateAction(linkId, url2, network, code);
				if(up_res == false){
					return;
				}
				
				//jQuery("#fbl_"+id).next("div.skip_button").remove();
				jQuery("#"+id).next("div.skip_button").remove();
				jQuery("#"+id).remove();
				jQuery("#fbl_"+id).remove();
				jQuery("#notf_"+id).show();
                               
			}
			else
			{
                jQuery("#"+id).remove();
				jQuery("#notf_"+id).remove();
				jQuery("#n_err_"+id).html(msg);
				jQuery("#n_err_"+id).show();
			}
		}
	});
}

function confirmSingleFB(id,url,linkId,network, isPriority, code, cpc, link_title){
	var allowedConfirmClicks = 4;
	if(jQuery("input[name=cbacn]").length){
		allowedConfirmClicks = jQuery("input[name=cbacn]").val();
	}
	if(confirmButtonClick > allowedConfirmClicks){
		return false;
	}
	
//	url2 = url.replace(/\&/g,"*#39");
	url2 = encodeURIComponent(url);
	url = encodeURIComponent(url);
	jQuery(".like_notification").html("&nbsp;");
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=checkFollowed&params={"id":"'+id+'", "url":"'+url+'", "network":"'+network+'"}',
		success: function(msg){
			if(msg==1)
			{
				if(network == 5 || network == 10){
					showImgCaptcha(id, url2, network, code, linkId, cpc, link_title);
				} else {
					updateAction(linkId, url2, network, code, msg, cpc, link_title);
				}
			}
			else
			{
				var rData = 'act=getLikeNote&params={"m":"'+msg+'", "cpc":"'+cpc+'", "title":"'+link_title+'"}';
				jQuery(".like_notification").show();
				ajaxRequest(rData, '.like_notification');
				getLinksList(1);
			}
		}
	});
}

function confirmYTView(id,url,linkId,network, isPriority, code, cpc, link_title){
	var allowedConfirmClicks = 4;
	if(jQuery("input[name=cbacn]").length){
		allowedConfirmClicks = jQuery("input[name=cbacn]").val();
	}
	if(confirmButtonClick > allowedConfirmClicks){
		return false;
	}
	
//	url2 = url.replace(/\&/g,"*#39");
	url2 = encodeURIComponent(url);
	url = encodeURIComponent(url);
	jQuery(".like_notification").html("&nbsp;");
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=checkYTFollowed&params={"id":"'+id+'", "url":"'+url+'", "network":"'+network+'"}',
		success: function(msg){
			if(msg==1)
			{
				showImgCaptcha(id, url2, network, code, linkId, cpc, link_title);	
			}
			else
			{
				var rData = 'act=getLikeNote&params={"m":"'+msg+'", "cpc":"'+cpc+'", "title":"'+link_title+'"}';
				jQuery(".like_notification").show();
				ajaxRequest(rData, '.like_notification');
				getLinksList(1);
			}
		}
	});
}

function showImgCaptcha(id, url, network, code, linkId, cpc, title){
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=showImageCapt&params={"id":"'+id+'", "url":"'+url+'", "network":"'+network+'", "code":"'+code+'", "link_id":"'+linkId+'", "cpc":"'+cpc+'", "link_title":"'+title+'"}',
		success: function(msg){
			jQuery("#site-links-list").hideLoading();
			jQuery("a.single_like_button").remove();
			jQuery("#duration-play-txt").remove();
			jQuery("div.likedPagesSingle").append(msg);
		}
	});
}



function getFBLikesBef(id,url,linkId,network, isPriority, code){
	url = encodeURIComponent(url);
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=getFBLikesDataBefore&params={"id":"'+id+'", "url":"'+url+'", "network":"'+network+'"}',    
		success: function(msg){
		}
	});
}


function captCheck(answer, id, linkId, url2, network, code, cpc, link_title){
	jQuery('div.img_capt_container').remove();
	jQuery("#site-links-list").showLoading();
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=checkCaptImage&params={"answer":"'+encodeURIComponent(answer)+'", "id":"'+id+'", "link_id":"'+linkId+'", "url":"'+encodeURIComponent(url2)+'", "network":"'+network+'", "code":"'+escape(code)+'"}',    
		success: function(msg){
			//alert(msg);
			if(msg == 1){
				updateAction(linkId, url2, network, code, msg, cpc, link_title);
			} else {
				var rData = 'act=getLikeNote&params={"m":"'+msg+'", "cpc":"'+cpc+'", "title":"'+link_title+'"}';
				jQuery(".like_notification").show();
				ajaxRequest(rData, '.like_notification');
				getLinksList(1);
				jQuery("#site-links-list").hideLoading();
			}
		}
	});
	
}



function resendConfirmEmail(){
	var email = jQuery("#rce_email").val();
	var code  = jQuery("#rce_capt").val();
	
	var data = 'act=rce&params={"email": "'+email+'", "code": "'+code+'"}';
	var container = ".reg_block";
	ajaxRequest(data, container, 'relaodSecImg');
}

function showConfirm(id, url, incr_id, type, skip, param, code){
	var func = 'none';
	if(type == 9){
		func = 'gCircled';
	}
	else if(type == 7 || type == 8 || type == 13 || type == 14){
		func = 'confirmFollow';
	}
	else if(type == 11 || type == 1){
		func = 'confirmSubscribe';
	}
	
	var str = '<div class="red" id="errorSubscribeCont"></div>'+
	'<img src="/images/layout/loading-small.gif" alt="Loading..." title="Loading..." width="32" height="32" class="loadingSubs" />'+
	'<input type="button" name="subscribe" id="subscribeButton" value="'+param+'" class="ysubscribeButton" onclick="'+func+'(\''+id+'\',\''+url+'\', \'L_'+incr_id+'\', \''+type+'\', 0, \''+code+'\')">'+ 
	'<div class="skip_button" id="L'+type+'_'+incr_id+'" style="float:none; margin-top:10px; display:inline-block; zoom:1;">'+skip+'</div>';
	
	jQuery(".mtop10 > center").html(str);
}

function reloadPagePopup(){
	jQuery("#timeout").dialog({
		minHeight: 200,
		width: 400,
		modal: true,
		resizable: false,
		dialogClass: 'no-close',
		draggable: false,
		open: function(event, ui) {
			jQuery(".ui-dialog-titlebar").hide();
			jQuery(".ui-dialog-titlebar-close").hide();
		},
		close: function(event, ui){
			
		}
	});
}

function captchaPopup(){
	jQuery("#security_c").dialog({
		minHeight: 500,
		width: 600,
		modal: true,
		resizable: false,
		dialogClass: 'no-close',
		draggable: false,
		open: function(event, ui) {
			jQuery(".ui-dialog-titlebar").hide();
			jQuery(".ui-dialog-titlebar-close").hide();
		},
		close: function(event, ui){
			
		}
	});
}

function checkCaptchNeed(){
	var r_data = 'act=capt_need';
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: r_data,
		cache: false,
		success: function(msg){
			if(msg == 1){
				captchaPopup();
			}
		}
	});
}

jQuery("#contest-send").live("click", function(){
	var contestF = jQuery("#contest-f").val();
	var contestS = jQuery("#contest-s").val();
	
	var data = 'act=contest&params={"first":"'+contestF+'", "second":"'+contestS+'"}';
	var container = "#contest-content";
	ajaxRequest(data, container);
});

jQuery("#sec_click_code_but").live("click", function(){
	var r_param = jQuery("#sec_click_code").serialize();
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=chec_sec_code&'+r_param,
		cache: false,
		success: function(msg){
			if(msg == 1){
				window.location.reload();
			} else {
				if(jQuery("#siimage").length)
					document.getElementById('siimage').src = 'securimage/securimage_show7278.png?sid=' + Math.random();
			}
		}
	});
});

function followTW(id,code,network){
	var elem = 'curElem'+id;
	var o = {};
	
	o[elem] = jQuery("#t_"+id).parent("div.twitter-single");
	jQuery("#tw_"+id).showLoading();
	jQuery("#t_"+id).remove();
	
	jQuery.ajax({
		type: "POST",
		url: "/../includes/twitter_ajax.php",
		data: 'act=twFollow&params={"id":"'+id+'", "code":"'+code+'", "network":"'+network+'"}',
		cache: false,
		success: function(msg){
			jQuery("#get_points_"+id).remove();
			jQuery("#tw_"+id).hideLoading();
			jQuery("#tw_"+id).append(msg);
			jQuery(".tip-tip").tipTip({
				defaultPosition: "top"
			});
			if(/tw_success/.test(msg)){
				jQuery("#tw_"+id).children("div.skip_tw").remove();
			}
		}
	});
}

function showpopup(container){
	jQuery('#'+container).popup({
		starttime: 0,
	    multipages_timer: false,
	    selfclose: 0,
	    popup_div: 'popup',
	    overlay_div: 'overlay',
	    close_id: 'close',
	    overlay: true,
	    opacity_level: 0.7,
	    overlay_cc: false,
	    centered: true,
	    top: 130,
	    left: 200,
	    setcookie: false,
	    cookie_name: 'popup',
	    cookie_timeout: 0,
	    cookie_views: 0,
	    floating: true,
	    floating_reaction: 700,
	    floating_speed: 3,
	    fly_in: true,
	    fly_from: 'top',
	    fly_out: false,
	    fly_to: 'bottom',
	    popup_appear: 'show',
	    popup_appear_time: '',
	    popup_disappear: 'hide',
	    popup_disappear_time: 0,
	    confirm_close: false,
	    confirm_close_text: 'Do you really want to close?'
	});
}

jQuery("#remove_ac_img").live("click", function(){
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=twAccRem',
		cache: false,
		success: function(msg){
			jQuery("#remove_ac_img").remove();
			jQuery(".twusername").html(msg);
		}
	});
});

jQuery("#remove_ms_ac_img").live("click", function(){
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=msAccRem',
		cache: false,
		success: function(msg){
			jQuery("#remove_ms_ac_img").remove();
			jQuery(".twusername").html(msg);
		}
	});
});

jQuery("#remove_net_ac_img").live("click", function(){
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=netAccRem',
		cache: false,
		success: function(msg){
			jQuery("#remove_net_ac_img").remove();
			jQuery(".twusername").html(msg);
		}
	});
});

jQuery("#remove_ytf_ac_img").live("click", function(){
	jQuery.ajax({
		type: "POST",
		url: "/../includes/ajax.php",
		data: 'act=ytfAccRem',
		cache: false,
		success: function(msg){
			jQuery("#remove_ytf_ac_img").remove();
			jQuery(".twusername").html(msg);
		}
	});
});

